package com.xqls.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xqls.dal.dao.RoleDao;
import com.xqls.dal.model.Role;
import com.xqls.dal.model.RoleExample;
import com.xqls.dal.model.RoleExample.Criteria;
import com.xqls.service.RoleService;

@Service
public class RoleServiceImpl implements RoleService {
	@Autowired private RoleDao roleDao;
	
	@Override
	public boolean insertRecord(Role record) {
		return this.roleDao.insertRecord(record);
	}

	@Override
	public boolean updateRecord(Role record) {
		return this.roleDao.updateRecord(record);
	}
	
	@Override
	public boolean deleteRecord(String roleId) {
		return this.roleDao.deleteRecord(roleId);
	}
	
	@Override
	public Role getLastRecord() {
		return this.roleDao.getLastRecord();
	}
	
	@Override
	public List<Role> getList() {
		RoleExample example=new RoleExample();
		return this.roleDao.getListByExample(example);
	}

	@Override
	public List<Role> getListById(String roleId) {
		RoleExample example=new RoleExample();
		Criteria criteria = example.createCriteria();
		criteria.andRoleIdEqualTo(roleId);
		return this.roleDao.getListByExample(example);
	}

	@Override
	public List<Role> getListByName(String roleName) {
		RoleExample example=new RoleExample();
		Criteria criteria = example.createCriteria();
		criteria.andRoleNameEqualTo(roleName);
		return this.roleDao.getListByExample(example);
	}
	
	@Override
	public List<Role> getListByMap(Map<String, Object> map) {
		return this.roleDao.getListByMap(map);
	}
}
